<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_goods_ship.*" %>
<%@page import="com.lmpop.trade.ts_area.*" %>
 
<%
	request.setCharacterEncoding("UTF-8");
	Ti_goods_ship ti_goods_ship = new Ti_goods_ship();
	Ti_goods_shipInfo shipfeearea = new Ti_goods_shipInfo();
	
	Ts_areaInfo areaBean = new Ts_areaInfo();
	List existlist = new ArrayList();
		
	String area_attr = "",cust_id="",goods_id="",user_id="";
	if( session.getAttribute("session_area_attr") != null ){
		area_attr = session.getAttribute("session_area_attr").toString();	
	}
	if( session.getAttribute("session_cust_id") != null ){
		cust_id = session.getAttribute("session_cust_id").toString();	
	}	 
	if(request.getParameter("goods_id")!=null && !request.getParameter("goods_id").equals("")){
		goods_id = request.getParameter("goods_id").trim();
	}
	ti_goods_ship.setGoods_id(goods_id);
	String areaAttr = "",cust_area="",ship_price="";
	String areaArr[] = area_attr.split("\\|");
	for( int k = 0; k < areaArr.length; k++ )
	{
			areaAttr = areaAttr + "-" + areaBean.getAreaNameById( areaArr[k]);
			cust_area=areaArr[k];
			ti_goods_ship.setArea_attr(cust_area);	
			existlist = shipfeearea.getListByGoods(ti_goods_ship);
			if (existlist == null || existlist.size()<=0)
			{
				if (k>0)
				{
					cust_area=areaArr[k-1];
					ti_goods_ship.setArea_attr(cust_area);	
					existlist = shipfeearea.getListByGoods(ti_goods_ship);
					break;
				}				
			}
			
	}
	
	
	
	if (existlist != null && existlist.size()>0)
	{
		Hashtable existlistMap =(Hashtable)existlist.get(0);
		 
		if(existlistMap.get("ship_price")!=null)
	  {
		 ship_price = existlistMap.get("ship_price").toString();
	  }
	  out.print("至"+areaAttr+"-运费:"+ship_price+"元");
	 }
	else
	{
		out.print("至"+areaAttr+"运费:请联系商家");
	}
	 
%> 
  	
  	
 

